-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix router tests #139
Fix router tests #139
Conversation
…-mainnet into fix/router-tests
…t into fix/router-tests
Regarding memory leak. In the `Write` method of the route group we call `writePacketAsync`. It returns `errCh` to us to wait the error from, this channel is not buffered, so `writePacketAsync`'s goroutine actually blocks while trying to pass error to this channel. But `Write` blocks on `select` waiting either error from `errCh` or error from write deadline struct. And if it gets deadline error, it just returns without waiting for any error from `errCh`, making `writePacketAsync` block forever on sending to the channel. And we might have had a lot of such running goroutines
Just one more subtest of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Just a small query for clearer commenting.
require.True(t, rg0.isClosed()) | ||
require.True(t, rg1.isRemoteClosed()) | ||
require.True(t, rg1.isClosed()) | ||
require.True(t, rg2.isRemoteClosed()) | ||
// rg1 should be done (not getting any new data, returning `io.EOF` on further reads) | ||
// but not closed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be specify:
// rg1 should be closed for reads (returning `io.EOF` on further reads), but not on writes.
Is this the intended behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@evanlinjin yep. io.EOF
is only returned when the connection is broken (we test this via isRemoteClosed
) and no data left on the wire (we check the readCh
for it). this was the only way to make route group behave like the usual connection, and also it seems like the most correct one to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
Fixes #102
Changes:
TestArbitrarySizeOneMessage
TestArbitrarySizeMultipleMessagesByChunks
testPresentTimeout
subtest ofTestConn
testCloseTimeout
subtest ofTestConn